package com.dc.designPattern._13_command.impl;

/**
 * Description: 命令模式_命令实现_灯泡关闭命令
 * @author: gdc
 * @date: 2021/4/20
 * @version 1.0
 */
public class LightOffCommand implements Command {

    /**
     * 聚合灯泡接收者
     */
    private LightReceiver lightReceiver;

    public LightOffCommand(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    @Override
    public void execute() {
        // 调用接收者任务
        lightReceiver.off();
    }

    @Override
    public void undo() {
        lightReceiver.on();
    }
}
